package com.example.firstapplication;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class SecondActivity extends AppCompatActivity {

    private EditText et_main_message;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        et_main_message=(EditText)findViewById(R.id.et_main_message);
        Intent intent = getIntent();

        String message = intent.getStringExtra("MESSAGE");
        this.et_main_message.setText(message);

    }


    public void back1(View v){
        finish();
    }

    public void back2(View v){

        //保存一个结果 准备一个带数据的intent对象
        Intent intent = new Intent();
        intent.putExtra("RESULT",this.et_main_message.getText().toString());
        setResult(3,intent);

        finish();
    }
}